package jm.nj.day07jia;
/*
* 定义商品类,有商品和价格私有属性,提供getset,设置有参无参方法
*
* 编写测试类,输入三个商品对象
*
* 求平均价格
* */
public class Commodity {


    private String name;
    private double price;

    public Commodity() {
    }

    public Commodity(String name, double price) {
        this.name = name;
        this.price = price;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getName() {
        return name;
    }

    public double getPrice() {
        return price;
    }

    @Override
    public String toString() {
        return "Commodity{" +
                "name='" + name + '\'' +
                ", price=" + price +
                '}';
    }


}
